<template>
	<view>
		<!-- 列表.10 - 列表.10 - 用户列表 -->
		<template v-if="YouRan_UI_LieBiao_10">
			<view class="YouRan-UI-LieBiao-10">
				<template v-if="YouRan_UI_LieBiao_10_JiaZai_ZhuangTai=='YouShuJu'">
					<view
						@click="$_TiaoZhuan('_XiangQing_YongHu/_XiangQing_YongHu?uid='+item.uid)"
						v-for="item in YouRan_UI_LieBiao_10.LieBiao"
						class="XunHuan Flex">
						<view class="Zuo">
							<image :src="item.avatar" mode="widthFix"></image>
						</view>
						<view class="Zhong">
							<view class="NiCheng H2">
								{{item.nickname}}
								<text class="P">{{item.roleName}}</text>
							</view>
							<view class="P">
								
								<text>{{item.stats.postPublishCount}}帖子</text>
								<text>{{item.stats.followMeCount}}关注</text>
								<text>{{item.stats.likeMeCount}}点赞</text>
							</view>
						</view>
						<view class="You Flex">
							<view
								@click.stop="YouRan_UI_LieBiao_10_DianJi_CaoZuo('follow',item)"
								class="Bj-BianKuangSe Zt-YuanSe">
								{{
									item.interaction.followStatus?
									"已关注":"关注"
								}}
							</view>
							<view
								@click.stop="YouRan_UI_LieBiao_10_DianJi_CaoZuo('like',item)"
								class="Bj-BianKuangSe Zt-YuanSe">
								{{
									item.interaction.likeStatus?
									"已点赞":"点赞"
								}}
							</view>
							<view
								@click.stop="YouRan_UI_LieBiao_10_SiLiao_DuiHua_DianJi(item.nickname,item.uid)"
								class="Bj-LanSe"
								style="color: #FFF;">私聊</view>
						</view>
					</view>
					<view
						v-if="YouRan_UI_LieBiao_10_JiaZai_ZhuangTai_JiaZaiGengDuo"
						@click="YouRan_UI_LieBiao_10_FangFa('FanYe')"
						class="H3 H3-Line Bj-BeiJingSe Zt-ZhanWeiSe Flex"
						style="padding: 35rpx 0;text-align: center;margin: 25rpx;justify-content: center;border-radius: 100rpx;">点击加载更多</view>
				</template>
				<template v-if="YouRan_UI_LieBiao_10_JiaZai_ZhuangTai=='JiaZaiZhong'">
					<YouRan-UI-JiaZaiZhong LeiXing="JuBu"></YouRan-UI-JiaZaiZhong>
				</template>
				<template v-if="YouRan_UI_LieBiao_10_JiaZai_ZhuangTai=='WuShuJu'">
					<view class="YouRan-UI-WuShuJu-1 Flex" style="padding: 50rpx 0;">
						<text class="iconfont icon-cry Zt-ZhanWeiSe"></text>
						<view class="Zt-ZhanWeiSe">暂无任何数据</view>
					</view>
				</template>
			</view>
			<view
				class="YouRan-UI-LieBiao-10-SiLiao-DuiHuaKuang"
				v-if="YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang">
				<view class="Shang" @click="YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang = false">
					<text>对 {{YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_nickname?YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_nickname:'Ta'}} 说</text>
					<text class="iconfont icon-close-bold"></text>
				</view>
				<view class="Xia">
					<input maxlength="-1" type="text" v-model="YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_Vmodel">
					<text></text>
					<view @click="YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_FangFa">发送</view>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	export default {
		name:"YouRan-UI-YongHu-LieBiao",
		props:{
			PeiZhi_WenJian:String,
		},
		data() {
			return {
				YouRan_UI_LieBiao_10:[],
				YouRan_UI_LieBiao_10_MoRen_YeMa:2,
				YouRan_UI_LieBiao_10_JiaZai_ZhuangTai:"JiaZaiZhong",
				YouRan_UI_LieBiao_10_JiaZai_ZhuangTai_JiaZaiGengDuo:false,
				YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_nickname:"",
				YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_uid:"",
				YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang:false,
				YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_Vmodel:""
			};
		},
		mounted(){
			this.QingQiu();
		},
		methods:{
			QingQiu(){
				uni.request({
					url:this.$_PeiZhi_WenJian() + this.PeiZhi_WenJian,
					method:'GET',
					success: (res) => {
						this.YouRan_UI_LieBiao_10 = res.data.QieHuanKa.LieBiao[3].ShaiXuan;
						if(this.YouRan_UI_LieBiao_10){this.YouRan_UI_LieBiao_10_FangFa()}
					}
				})
			},
			// 列表.10 - 列表.10 - 用户列表
			YouRan_UI_LieBiao_10_FangFa(e){
				let FanYe = e;
				if(FanYe){uni.showLoading({ title: "加载中" });}
				let FanWei_RenZhengZhuangTai = this.YouRan_UI_LieBiao_10.FanWei_RenZhengZhuangTai,
					FanWei_XingBie = this.YouRan_UI_LieBiao_10.FanWei_XingBie,
					FanWei_ZhuCe_ShiJian_DaYu = this.YouRan_UI_LieBiao_10.FanWei_ZhuCe_ShiJian_DaYu,
					FanWei_ZhuCe_ShiJian_XiaoYu = this.YouRan_UI_LieBiao_10.FanWei_ZhuCe_ShiJian_XiaoYu,
					FanWei_DianZan_DaYu = this.YouRan_UI_LieBiao_10.FanWei_DianZan_DaYu,
					FanWei_DianZan_XiaoYu = this.YouRan_UI_LieBiao_10.FanWei_DianZan_XiaoYu,
					FanWei_GuanZhu_DaYu = this.YouRan_UI_LieBiao_10.FanWei_GuanZhu_DaYu,
					FanWei_GuanZhu_XiaoYu = this.YouRan_UI_LieBiao_10.FanWei_GuanZhu_XiaoYu,
					FanWei_FaTie_DaYu = this.YouRan_UI_LieBiao_10.FanWei_FaTie_DaYu,
					FanWei_FaTie_XiaoYu = this.YouRan_UI_LieBiao_10.FanWei_FaTie_XiaoYu,
					FanWei_PingLun_DaYu = this.YouRan_UI_LieBiao_10.FanWei_PingLun_DaYu,
					FanWei_PingLun_XiaoYu = this.YouRan_UI_LieBiao_10.FanWei_PingLun_XiaoYu,
					FanWei_JingHuaTi_DaYu = this.YouRan_UI_LieBiao_10.FanWei_JingHuaTi_DaYu,
					FanWei_JingHuaTi_XiaoYu = this.YouRan_UI_LieBiao_10.FanWei_JingHuaTi_XiaoYu,
					FanWei_PaiXu_LeiXing = this.YouRan_UI_LieBiao_10.FanWei_PaiXu_LeiXing,
					FanWei_PaiXu_FangXiang = this.YouRan_UI_LieBiao_10.FanWei_PaiXu_FangXiang,
					FanWei_XianShi_TiaoShu = this.YouRan_UI_LieBiao_10.FanWei_XianShi_TiaoShu;
				this.$_QingQiu(
					"GET","/api/v2/user/list",
					{
						"verified":FanWei_RenZhengZhuangTai,
						"gender":FanWei_XingBie,
						"createDateGt":FanWei_ZhuCe_ShiJian_DaYu,
						"createDateLt":FanWei_ZhuCe_ShiJian_XiaoYu,
						"likeCountGt":FanWei_DianZan_DaYu,
						"likeCountLt":FanWei_DianZan_XiaoYu,
						"followCountGt":FanWei_GuanZhu_DaYu,
						"followCountLt":FanWei_GuanZhu_XiaoYu,
						"postCountGt":FanWei_FaTie_DaYu,
						"postCountLt":FanWei_FaTie_XiaoYu,
						"commentCountGt":FanWei_PingLun_DaYu,
						"commentCountLt":FanWei_PingLun_XiaoYu,
						"postDigestCountGt":FanWei_JingHuaTi_DaYu,
						"postDigestCountLt":FanWei_JingHuaTi_XiaoYu,
						"orderType":FanWei_PaiXu_LeiXing,
						"orderDirection":FanWei_PaiXu_FangXiang,
						"whitelistKeys":"uid,avatar,nickname,roleName,stats.postPublishCount,stats.followMeCount,stats.likeMeCount,interaction.followStatus,interaction.likeStatus",
						"pageSize":FanWei_XianShi_TiaoShu,
						"page":FanYe ? this.YouRan_UI_LieBiao_10_MoRen_YeMa : ""
					},
					(res) => {
						if(FanYe){
							if(res.data.data.list.length){
								this.$set(this.YouRan_UI_LieBiao_10,'LieBiao',this.YouRan_UI_LieBiao_10.LieBiao.concat(res.data.data.list))
								this.YouRan_UI_LieBiao_10_MoRen_YeMa++
								uni.hideLoading();
							}else{
								uni.showToast({
									title: "没有数据啦",
									icon: "none",
									duration: 1000
								});
							}
						}else{
							if(res.data.data.paginate.total > res.data.data.paginate.pageSize){
								this.YouRan_UI_LieBiao_10_JiaZai_ZhuangTai_JiaZaiGengDuo = true
							}
							this.$set(this.YouRan_UI_LieBiao_10,'LieBiao',res.data.data.list)
							if(this.YouRan_UI_LieBiao_10.LieBiao.length){
								this.YouRan_UI_LieBiao_10_JiaZai_ZhuangTai = "YouShuJu"
							}else{
								this.YouRan_UI_LieBiao_10_JiaZai_ZhuangTai = "WuShuJu"
							}
						}
					}
				)
			},
			// 列表.10 - 列表.10 - 用户列表 - 点击 - 私聊
			YouRan_UI_LieBiao_10_SiLiao_DuiHua_DianJi(nickname,uid){
				this.YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_nickname = nickname;
				this.YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_uid = uid;
				this.YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang = true;
			},
			// 列表.10 - 列表.10 - 用户列表 - 私聊对话框 - 方法
			YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_FangFa(){
				uni.showLoading({ title: "发送中" });
				this.$_QingQiu(
					"POST","/api/v2/conversation/send-message",
					{
						"uidOrUsername":this.YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_uid.toString(),
						"message":this.YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_Vmodel
					},
					(res) => {
						uni.hideLoading();
						if(res.data.code == 0){
							this.YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang_Vmodel = "";
							uni.showToast({
								title:"发送成功",
								icon:"none",
								duration:1000
							});
							this.YouRan_UI_LieBiao_10_SiLiao_DuiHua_Kuang = false
						}else{
							uni.showToast({
								title:res.data.message,
								icon:"none",
								duration:1000
							});
						}
					}
				)
			},
			// 列表.10 - 列表.10 - 用户列表 - 操作 - 方法
			YouRan_UI_LieBiao_10_DianJi_CaoZuo(LeiXing,item){
				uni.showLoading();
				this.$_QingQiu(
					"POST","/api/v2/user/mark",
					{
						"interactionType":LeiXing,
						"markType":"user",
						"fsid":item.uid.toString()
					},
					(res) => {
						uni.hideLoading();
						if(res.data.code == 0){
							if(LeiXing == 'like'){
								this.$set(item.interaction,'likeStatus',!item.interaction.likeStatus)
							}
							if(LeiXing == 'follow'){
								this.$set(item.interaction,'followStatus',!item.interaction.followStatus)
							}
						}else{
							uni.showToast({
								title:res.data.message,
								icon:"none",
								duration:1000
							});
						}
					}
				)
			},
		},
	}
</script>

<style>

</style>